<template>
  <div>
    <a @click="dispatchClick('edit')" v-if="allPermissions.devListEdit">{{ $t("devicesListSettings.devListEdit") }}</a>
    <!-- <Divider type="vertical" v-if="allPermissions.devListRelieve&&allPermissions.devListEdit" />
    <a @click="_handleBind" v-if="allPermissions.devListRelieve">{{ row.areaId ? $t('devicesListSettings.devListRelieve') : $t('devicesListSettings.devListBind') }}</a> -->
    <Divider type="vertical" v-if="allPermissions.devListCut||allPermissions.devListrestart||allPermissions.devListDel||allPermissions.devTimezones" />
    <Dropdown
      transfer
      v-if="allPermissions.devListCut||allPermissions.devListrestart||allPermissions.devListDel||allPermissions.devTimezones"
    >
      <a>
        {{ $t("devicesListSettings.devListMore") }}
        <Icon type="ios-arrow-down" />
      </a>
      <DropdownMenu slot="list" >
        <DropdownItem @click.native="dispatchClick('open')" v-if="allPermissions.devListCut">{{ $t("devicesListSettings.devListCut") }}</DropdownItem>
        <!-- <DropdownItem>关闸</DropdownItem> -->
        <DropdownItem @click.native="dispatchClick('restart')" v-if="allPermissions.devListrestart">{{ $t("devicesListSettings.devListrestart") }}</DropdownItem>
        <DropdownItem @click.native="dispatchClick('del')" v-if="allPermissions.devListDel">{{ $t("devicesListSettings.devListDel") }}</DropdownItem>
        <!-- <DropdownItem @click.native="dispatchClick('Time')">{{ $t("devicesListSettings.devListTime") }}</DropdownItem> -->
        <DropdownItem @click.native="dispatchClick('Timezone')" v-if="allPermissions.devTimezones">{{ $t("devicesCreate.devTimezones") }}</DropdownItem>
        <DropdownItem @click.native="dispatchClick('restoreSetting')" v-if="allPermissions.restoreSetting">{{ $t("devicesIndex.restoreSetting") }}</DropdownItem>
        <!-- <DropdownItem @click.native="dispatchClick('passPerson')" >{{ $t("devicesIndex.passPerson") }}</DropdownItem> -->
      </DropdownMenu>
    </Dropdown>
  </div>
</template>

<script>
export default {
  props: {
    row: Object,
    allPermissions: Object,
  },

  methods: {
    dispatchClick (name, props) {
      console.log(this.row)
      this.$emit('itemClick', name, props)
    },

    _handleBind () {
      this.dispatchClick('bindArea', this.row)
    },
  },
}
</script>
